package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.FaultCustForm;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.domain.WorkForm;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.IWorkCustomerService;
import com.ruoyi.system.service.IWorkFormService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

@Controller
@RequestMapping("/system/finishCheck")
public class finishCheckController extends BaseController {
    private String prefix = "system/check";

    @Autowired
    private IWorkFormService workFormService;
   // @RequiresPermissions("system:finishCheck:view")
    @GetMapping()
    public String customer()
    {
        return prefix + "/finishCheck";
    }

    /**
     * 查询用户列表
     */
   // @RequiresPermissions("system:pend:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkForm workForm)
    {
        startPage();
        String loginName = "admin";

        List<FaultCustForm> list =workFormService.selectWorkFinishCheckListOk(workForm,loginName);
        return getDataTable(list);
    }
    /*
    已完成审核
     */
    @PostMapping("/finishCheckOk/{id}")
    @ResponseBody
    public AjaxResult finishCheckOk(@PathVariable("id") Long id)
    {
        Long returnId = 1L;
        return toAjax(workFormService.updateWorkFormBycheckOk(id,returnId));
    }
    /*
    已完成审核
     */
    @PostMapping("/finishCheckOff/{id}")
    @ResponseBody
    public AjaxResult finishCheckOff(@PathVariable("id") Long id)
    {
        Long returnId=2L;
        return toAjax(workFormService.updateWorkFormBycheckOk(id,returnId));
    }
}
